<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.1.1">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/avatar.jpg">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/avatar.jpg">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/avatar.jpg">
  <link rel="mask-icon" href="/images/avatar.jpg" color="#222">
  <meta name="msvalidate.01" content="4AF2328B2035748153A041B7EEF3D15C">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Serif+SC:300,300italic,400,400italic,700,700italic%7CLobster:300,300italic,400,400italic,700,700italic%7CPingFang+SC:300,300italic,400,400italic,700,700italic%7CRoboto+Mono:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.33/fancybox/fancybox.css" integrity="sha256-gkQVf8UKZgQ0HyuxL/VnacadJ+D2Kox2TCEBuNQg5+w=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"ethanliu6.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":true,"sidebar":{"position":"left","display":"always","padding":12,"offset":18},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":true,"color":"#222","save":"manual"},"mediumzoom":true,"lazyload":true,"pangu":false,"comments":{"style":"buttons","active":"changyan","storage":true,"lazyload":false,"nav":null,"activeClass":"changyan"},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":6,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="JavaSE基础——Day01 该篇主要讲解Java入门&amp;IDEA&amp;基础语法">
<meta property="og:type" content="article">
<meta property="og:title" content="JavaSE基础——Day01 JavaSE基础——Java入门&amp;IDEA&amp;基础语法">
<meta property="og:url" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/index.html">
<meta property="og:site_name" content="&lt;font color&#x3D;&#39;white&#39; &gt;Ethan の Blog&lt;&#x2F;font&gt;">
<meta property="og:description" content="JavaSE基础——Day01 该篇主要讲解Java入门&amp;IDEA&amp;基础语法">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/java%E4%B9%8B%E7%88%B6.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/JavaSE.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/JavaME.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/JavaEE.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639723620672.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724104275.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724256038.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724347484.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724972428.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725058972.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725324201.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725464573.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725550686.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725745872.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725786272.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639738100464.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639738273278.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639739017544.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639739214830.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639739296629.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740068163.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740084193.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740114726.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740232557.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740689831.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740752206.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639741645239.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639741741808.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639741820153.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639741944747.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742119302.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742154126.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/image-20240426010742391.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742942464.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742964462.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743071477.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743252803.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743315958.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743577863.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743669575.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743724589.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743891697.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744009142.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744035432.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744182660.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744260619.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744399116.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744560888.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744630418.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744766449.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744868162.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744975845.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639745070048.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639745121075.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639745243246.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639745503256.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639745567182.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639745635074.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639745672970.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639745760081.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639745840868.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639745874976.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639746135128.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639746171990.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639746269066.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639746912516.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639747135494.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639747240911.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639747313468.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639747438239.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639747499310.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639747543186.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639746974241.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639748122994.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639748232481.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639748532558.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639748712003.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639748785687.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639748866566.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639749167095.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639749235135.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639749348313.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639749389479.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639749434719.png">
<meta property="og:image" content="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/imgs/1639749873847.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639749999955.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639750064471.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639750407320.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639750514625.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639751032842.png">
<meta property="article:published_time" content="2024-03-12T16:00:00.000Z">
<meta property="article:modified_time" content="2024-04-26T05:14:42.588Z">
<meta property="article:author" content="Ethan Liu">
<meta property="article:tag" content="Java">
<meta property="article:tag" content="Java基础">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/java%E4%B9%8B%E7%88%B6.png">


<link rel="canonical" href="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/","path":"2024/03/13/JavaNotes/JavaSE基础/day01Java入门&IDEA&基础语法/","title":"JavaSE基础——Day01 JavaSE基础——Java入门&IDEA&基础语法"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>JavaSE基础——Day01 JavaSE基础——Java入门&IDEA&基础语法 | <font color='white' >Ethan の Blog</font></title>
  








  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<style>.darkmode--activated{--body-bg-color:#282828;--content-bg-color:#333;--card-bg-color:#555;--text-color:#ccc;--blockquote-color:#bbb;--link-color:#ccc;--link-hover-color:#eee;--brand-color:#ddd;--brand-hover-color:#ddd;--table-row-odd-bg-color:#282828;--table-row-hover-bg-color:#363636;--menu-item-bg-color:#555;--btn-default-bg:#222;--btn-default-color:#ccc;--btn-default-border-color:#555;--btn-default-hover-bg:#666;--btn-default-hover-color:#ccc;--btn-default-hover-border-color:#666;--highlight-background:#282b2e;--highlight-foreground:#a9b7c6;--highlight-gutter-background:#34393d;--highlight-gutter-foreground:#9ca9b6}.darkmode--activated img{opacity:.75}.darkmode--activated img:hover{opacity:.9}.darkmode--activated code{color:#69dbdc;background:0 0}button.darkmode-toggle{z-index:9999}.darkmode-ignore,img{display:flex!important}.beian img{display:inline-block!important}</style></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title"><font color='white' >Ethan の Blog</font></p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description"><font color='#FDABC1' size=3>清醒的停留，胜过——盲目的前行</font></p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-关于我"><a href="/aboutme/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">18</span></a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">14</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">53</span></a></li><li class="menu-item menu-item-love"><a href="/categories/Love/" rel="section"><i class="fas fa-heart fa-fw"></i>Love</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#java%E5%85%A5%E9%97%A8"><span class="nav-text">1：Java入门</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#java%E7%AE%80%E4%BB%8B"><span class="nav-text">1.1 Java简介</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#jdk%E7%9A%84%E4%B8%8B%E8%BD%BD%E5%92%8C%E5%AE%89%E8%A3%85"><span class="nav-text">1.2 JDK的下载和安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F"><span class="nav-text">1.3 第一个程序</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98"><span class="nav-text">1.4 常见问题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%B8%B8%E7%94%A8dos%E5%91%BD%E4%BB%A4"><span class="nav-text">1.5 常用DOS命令</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#path%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="nav-text">1.6 Path环境变量</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#idea"><span class="nav-text">2：IDEA</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#idea%E6%A6%82%E8%BF%B0%E5%92%8C%E5%AE%89%E8%A3%85"><span class="nav-text">2.1 IDEA概述和安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#idea%E4%B8%ADhelloworld"><span class="nav-text">2.2 IDEA中HelloWorld</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#idea%E4%B8%AD%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E6%B3%A8%E9%87%8A"><span class="nav-text">2.3 IDEA中基本配置&amp;注释</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#idea%E4%B8%AD%E5%B8%B8%E7%94%A8%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="nav-text">2.4 IDEA中常用快捷键</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#idea%E4%B8%AD%E6%A8%A1%E5%9D%97%E6%93%8D%E4%BD%9C"><span class="nav-text">2.5 IDEA中模块操作</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95"><span class="nav-text">3：基础语法</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AD%97%E9%9D%A2%E9%87%8F"><span class="nav-text">3.1 字面量</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">3.2 数据类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8F%98%E9%87%8F"><span class="nav-text">3.3 变量</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8F%98%E9%87%8F%E7%9A%84%E6%A1%88%E4%BE%8B"><span class="nav-text">3.4 变量的案例</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%89%8B%E6%9C%BA%E4%BF%A1%E6%81%AF%E6%8F%8F%E8%BF%B0"><span class="nav-text">3.4.1 手机信息描述</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E7%96%AB%E6%83%85%E9%98%B2%E6%8E%A7%E4%BF%A1%E6%81%AF%E9%87%87%E9%9B%86%E8%A1%A8"><span class="nav-text">3.4.2 疫情防控信息采集表</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8F%98%E9%87%8F%E7%9A%84%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9"><span class="nav-text">3.5 变量的注意事项</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%85%B3%E9%94%AE%E5%AD%97"><span class="nav-text">3.6 关键字</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%A0%87%E8%AF%86%E7%AC%A6"><span class="nav-text">3.7 标识符</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Ethan Liu"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">Ethan Liu</p>
  <div class="site-description" itemprop="description"><font color='#0000FF' size=1.5px>语言学 | NLP | Py | Java</font></div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">53</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">18</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2V0aGFubGl1Ng==" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ethanliu6"><i class="fab fa-github fa-fw"></i>GitHub</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOmxpdWUyMzM2QGdtYWlsLmNvbQ==" title="E-Mail → mailto:liue2336@gmail.com"><i class="fa fa-envelope fa-fw"></i>E-Mail</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9zcGFjZS5iaWxpYmlsaS5jb20vMTMyNzA5OTk3Nw==" title="BiliBili → https:&#x2F;&#x2F;space.bilibili.com&#x2F;1327099977"><i class="fa-brands fa-bilibili fa-fw"></i>BiliBili</span>
      </span>
      <span class="links-of-author-item">
        <a href="/categories/Love/" title="Love → &#x2F;categories&#x2F;Love&#x2F;" rel="noopener me"><i class="fa fa-heart fa-fw"></i>Love</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="Ethan Liu">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="<font color='white' >Ethan の Blog</font>">
      <meta itemprop="description" content="<font color='#0000FF' size=1.5px>语言学 | NLP | Py | Java</font>">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="JavaSE基础——Day01 JavaSE基础——Java入门&IDEA&基础语法 | <font color='white' >Ethan の Blog</font>">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          JavaSE基础——Day01 JavaSE基础——Java入门&IDEA&基础语法<span class="exturl post-edit-link" data-url="aHR0cHM6Ly9naXRodWIuY29tL0V0aGFuTGl1Ni9ldGhhbmxpdTYuZ2l0aHViLmlvL3RyZWUvbWFzdGVyL19wb3N0cy9KYXZhTm90ZXMvSmF2YVNF5Z+656GAL2RheTAxSmF2YeWFpemXqCZJREVBJuWfuuehgOivreazlS5tZA==" title="编辑"><i class="fa fa-pen-nib"></i></span>
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2024-03-13 00:00:00" itemprop="dateCreated datePublished" datetime="2024-03-13T00:00:00+08:00">2024-03-13</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2024-04-26 13:14:42" itemprop="dateModified" datetime="2024-04-26T13:14:42+08:00">2024-04-26</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Java%E5%85%A8%E6%A0%88/" itemprop="url" rel="index"><span itemprop="name">Java全栈</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    <a title="JavaSE基础——Day01 JavaSE基础——Java入门&IDEA&基础语法" href="/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/#SOHUCS" itemprop="discussionUrl">
      <span id="sourceId::1f34dcf3b743f850784de6d903de63b7" class="cy_cmt_count" itemprop="commentCount"></span>
    </a>
  </span>
  
  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>6.5k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>24 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><blockquote class="blockquote-center">
<p>JavaSE基础——Day01
该篇主要讲解<strong>Java入门&amp;IDEA&amp;基础语法</strong></p>

</blockquote>
<span id="more"></span>
<p><strong>今日目标：</strong></p>
<ul>
<li>能够完成JDK和IDEA的安装</li>
<li>能够知道Java程序开发流程</li>
<li>能够完成Java环境变量的配置</li>
<li>能够使用IDEA进行Java程序的开发</li>
<li>能够根据需求完成变量的定义和使用(包括输出和修改)</li>
<li>能够知道注释，字面量，关键字，标识符的作用</li>
</ul>
<h2 id="java入门">1：Java入门</h2>
<h3 id="java简介">1.1 Java简介</h3>
<p>下面我们正式进入Java的学习，在这里，大家第一个关心的问题，应该就是Java是什么，我们一起来看一下：</p>
<p><strong>Java是什么：</strong></p>
<ul>
<li>Java是一门非常优秀的计算机语言
<ul>
<li>语言：人与人交流沟通的表达方式</li>
<li>计算机语言：人与计算机之间进行信息交流沟通的一种特殊语言</li>
</ul></li>
<li>Java之父：詹姆斯·高斯林（James Gosling）</li>
</ul>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/java之父.png" alt="Java之父：詹姆斯·高斯林">
<figcaption aria-hidden="true">Java之父：詹姆斯·高斯林</figcaption>
</figure>
<p>知道了Java是什么之后，大家就会想，我们学完Java可以做什么呢？下面，我们就来聊一聊，Java的三大技术平台：</p>
<p><strong>1：JavaSE</strong></p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/JavaSE.png" alt="JavaSE">
<figcaption aria-hidden="true">JavaSE</figcaption>
</figure>
<p><strong>2：JavaME</strong></p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/JavaME.png" alt="JavaME">
<figcaption aria-hidden="true">JavaME</figcaption>
</figure>
<p><strong>3：JavaEE</strong></p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/JavaEE.png" alt="JavaEE">
<figcaption aria-hidden="true">JavaEE</figcaption>
</figure>
<p>课程安排：</p>
<p>要开发一个Java程序，我们得安装JDK，而要安装JDK，我们得先有JDK，所以，我们会先来讲解JDK的下载和安装JDK的下载和安装讲解完毕之后，我们就可以进行Java程序的开发了，</p>
<p>这里我会带着大家一起开发第一个Java程序，而大家在练习的过程中可能会出现一些小问题，所以，在大家练习后，我们会讲解一下开发中的常见问题。</p>
<p>最后呢，我们还会讲解两个小知识，一个是常用DOS命令，一个是Path环境变量，让大家对前面使用过的一些工具能够做到知其然并知其所以然。</p>
<h3 id="jdk的下载和安装">1.2 JDK的下载和安装</h3>
<p>下面呢，我们来学习JDK的下载与安装，在讲解JDK的下载与安装之前呢，我们先对JDK做一个介绍：</p>
<p><strong>JDK：</strong>（<font color="red"><strong>JavaDevelopment
Kit</strong></font>)：Java开发工具包，也就是说必须要有JDK才能开发Java程序</p>
<p>所以，我们得先安装了JDK，然后才能进行Java程序的开发。</p>
<p>了解了JDK是什么之后，我们再来对JDK的版本做一个说明：</p>
<figure>
<img data-src="imgs/1639723620672.png" alt="1639723620672">
<figcaption aria-hidden="true">1639723620672</figcaption>
</figure>
<p>这么多的版本，大家不用记，了解即可。知道三个版本就可以了，这里我们标红了：JDK8，JDK11，JDK17。JDK8是企业用的最多的版本，JDK11和JDK17是后续长期支持更新的版本。</p>
<p>了解了JDK的版本之后，下面呢，我们来学习JDK的下载。</p>
<p><strong>JDK的下载：</strong></p>
<ul>
<li>通过官方网站获取JDK（https://www.oracle.com/）</li>
<li>直接下载地址：
https://www.oracle.com/java/technologies/javase-downloads.html</li>
<li><font color="red"><strong>注意：针对不同操作系统，下载对应的JDK</strong></font></li>
</ul>
<p>JDK下载图解</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724104275.png" alt="1639724104275">
<figcaption aria-hidden="true">1639724104275</figcaption>
</figure>
<p>下载完成后，在本地可以看到下载好的软件：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724256038.png" alt="1639724256038">
<figcaption aria-hidden="true">1639724256038</figcaption>
</figure>
<p>JDK下载好之后，下面我们就要来安装JDK了。</p>
<p><strong>JDK的安装：</strong></p>
<p>关于安装，这里我们说两点：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724347484.png" alt="1639724347484">
<figcaption aria-hidden="true">1639724347484</figcaption>
</figure>
<p>JDK安装图解：</p>
<p>第一步：双击启动下载好的JDK软件，在弹出框界面选择是</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639724972428.png" alt="1639724972428">
<figcaption aria-hidden="true">1639724972428</figcaption>
</figure>
<p>第二步：看到如下界面，点击下一步</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725058972.png" alt="1639725058972">
<figcaption aria-hidden="true">1639725058972</figcaption>
</figure>
<p>第三步：看到如下界面，不要着急安装，因为它默认会安装到C:Files下面，点击更改</p>
<p>第四步：看到如下界面，修改安装路径</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725324201.png" alt="1639725324201">
<figcaption aria-hidden="true">1639725324201</figcaption>
</figure>
<p>第五步：看到如下界面，点击下一步，等待安装</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725464573.png" alt="1639725464573">
<figcaption aria-hidden="true">1639725464573</figcaption>
</figure>
<p>第六步：看到如下界面，说明安装成功，点击关闭即可</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725550686.png" alt="1639725550686">
<figcaption aria-hidden="true">1639725550686</figcaption>
</figure>
<p>JDK安装完成后，我们到安装目录下去看看JDK的安装目录：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725745872.png" alt="1639725745872">
<figcaption aria-hidden="true">1639725745872</figcaption>
</figure>
<p><strong>目录解释：</strong></p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639725786272.png" alt="1639725786272">
<figcaption aria-hidden="true">1639725786272</figcaption>
</figure>
<p>到此，我们就完成了JDK的安装，大家赶快根据老师提供的JDK软件，完成JDK的安装吧。</p>
<h3 id="第一个程序">1.3 第一个程序</h3>
<p>JDK安装完毕后，下面我们来开发自己的第一个Java程序。</p>
<p>首先，我们来说一下，Java程序的开发流程：</p>
<p>开发一个Java
程序，需要三个步骤：编写程序，编译程序，运行程序。如图</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639738100464.png" alt="1639738100464">
<figcaption aria-hidden="true">1639738100464</figcaption>
</figure>
<p>知道了Java程序的开发流程后，下面我们来实现第一个程序：</p>
<p>第一步：编写程序</p>
<p>① 在D盘根目录下新建一个文本文档文件，修改文件名为HelloWorld.java</p>
<p>② 选中HelloWorld.java文件，用Windows系统自带的记事本打开</p>
<p>③ 书写如下程序内容</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639738273278.png" alt="1639738273278">
<figcaption aria-hidden="true">1639738273278</figcaption>
</figure>
<p>④ 保存文件：Ctrl+s</p>
<p><font color="red"><strong>注意：</strong></font></p>
<ul>
<li>文件后缀名是.java，文件类型是java文件</li>
<li>文件名和代码中类名一致</li>
</ul>
<p>如果后缀名还是文本文档文件，需要按照下面的步骤，勾选文件扩展名</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639739017544.png" alt="1639739017544">
<figcaption aria-hidden="true">1639739017544</figcaption>
</figure>
<p>程序编写完毕后，要进行编译和运行程序。而编译和运行程序目前需要在DOS窗口下进行，因此我们先说一下如何打开DOS窗口</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639739214830.png" alt="1639739214830">
<figcaption aria-hidden="true">1639739214830</figcaption>
</figure>
<p>说完了如何打开DOS窗口，接下来，我们来学习编译和运行程序。</p>
<p>第二步：编译程序</p>
<ul>
<li>格式：javac 文件名.java</li>
<li>范例：javac HelloWorld.java</li>
</ul>
<p>第三步：运行程序</p>
<ul>
<li>格式：java 类名</li>
<li>范例：java HelloWorld</li>
</ul>
<p>如图所示：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639739296629.png" alt="1639739296629">
<figcaption aria-hidden="true">1639739296629</figcaption>
</figure>
<p>最终再控制台输出了：HelloWorld。到此第一个程序开发完毕。大家赶快动手练习吧。</p>
<h3 id="常见问题">1.4 常见问题</h3>
<p>刚才大家在练习的过程中，有些同学出现了一些小问题，这里呢，我们来讲解一下常见的两个小问题：</p>
<p><strong>1：单词拼写问题</strong></p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740068163.png" alt="1639740068163">
<figcaption aria-hidden="true">1639740068163</figcaption>
</figure>
<p><strong>2：中英文符号问题</strong></p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740084193.png" alt="1639740084193">
<figcaption aria-hidden="true">1639740084193</figcaption>
</figure>
<p>而关于中英文符号问题，早期的windows系统报错信息如下：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740114726.png" alt="1639740114726">
<figcaption aria-hidden="true">1639740114726</figcaption>
</figure>
<p>这两个常见的小问题呢，大家了解一下即可，因为很快我们将会使用一款非常优秀的开发工具，这些问题将不会存在了。但是，如果出现类似的问题，我们要学会阅读并解决问题。</p>
<p>最后，再给大家补充一个小知识，JDK11的新特性：</p>
<p><strong>JDK11开始支持 java命令直接运行.java文件</strong></p>
<ul>
<li>格式：java 文件名.java</li>
<li>范例：java HelloWorld.java</li>
</ul>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740232557.png" alt="1639740232557">
<figcaption aria-hidden="true">1639740232557</figcaption>
</figure>
<p>有同学可能不小心这样写了，不知道为什么，这里我们就给大家统一说明一下。到此，关于第一个程序的常见问题我们就先说到这里。</p>
<h3 id="常用dos命令">1.5 常用DOS命令</h3>
<p>在后续开发中，我们有些时候需要在DOS窗口，也就是我们前面见到的黑窗口下进行一些操作，所以，我们要掌握一些常用的操心命令。</p>
<p>而这些命令，又需要在黑窗口下运行，所以，这里我们先讲解如何打开DOS窗口，这里我们讲解两种常见的方式：</p>
<ol type="1">
<li>直接在地址栏输入cmd，回车即可</li>
<li>通过运行窗口打开</li>
</ol>
<p>第一种方式，我们已经用过了。这里我们重点说第二种方式，通过运行窗口打开：</p>
<p>① 按下win+R</p>
<p>② 输入cmd</p>
<p>③ 按下回车键</p>
<p>这样，我们就通过运行窗口打开了DOS窗口。下面呢，我们来学习常用的DOS命令。</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740689831.png" alt="1639740689831">
<figcaption aria-hidden="true">1639740689831</figcaption>
</figure>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639740752206.png" alt="1639740752206">
<figcaption aria-hidden="true">1639740752206</figcaption>
</figure>
<p>根据老师的讲解，大家练习一下常用的DOS命令吧。</p>
<h3 id="path环境变量">1.6 Path环境变量</h3>
<p>前面我们使用过JDK的bin目录下的javac和java命令，为什么我们能够直接使用呢？这里我们来讲解一下原理。而要讲解这个原理，我们就不得不提一下Path环境变量。</p>
<p><strong>Path环境变量的作用：</strong></p>
<ul>
<li>它提供了windows命令行中指令的可执行文件(比如：.exe文件)路径，让我们在命令行中输入命令时，能够找到对应的可执行文件执行</li>
<li>简单说：让命令在命令行中使用有效</li>
</ul>
<p>为了让大家更好的理解这句话，我们来做一个操作，验证一下：</p>
<ul>
<li>在Path环境变量中配置QQ软件的命令行方式启动</li>
<li>C:Files (x86)</li>
</ul>
<p>如何配置呢？按照下图配置即可</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639741645239.png" alt="1639741645239">
<figcaption aria-hidden="true">1639741645239</figcaption>
</figure>
<figure>
<img data-src="imgs/1639741741808.png" alt="1639741741808">
<figcaption aria-hidden="true">1639741741808</figcaption>
</figure>
<p>配置完毕之后，我们到DOS窗口中，通过qq指令，就可以启动QQ软件了。</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639741820153.png" alt="1639741820153">
<figcaption aria-hidden="true">1639741820153</figcaption>
</figure>
<p>由此可见，我们把.exe文件所在的路径配置到Path环境变量中，就可以使用.exe结尾的指令来启动程序了。这个时候，我们来说一下，为什么开始的时候我们能够直接使用javac和java指定了。</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639741944747.png" alt="1639741944747">
<figcaption aria-hidden="true">1639741944747</figcaption>
</figure>
<p>但是，由于这种配置，只配置了较少的命令，而我们在JDK的bin目录下还有很多的命令可以使用，比如：jps,jpackage,jmap等。所以，我们要自己配置JDK的环境变量，为了后续的一些软件能够找到JDK的安装目录，我们分两步来完成Java环境变量的配置：</p>
<p>第一步：配置JAVA_HOME变量</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742119302.png" alt="1639742119302">
<figcaption aria-hidden="true">1639742119302</figcaption>
</figure>
<p>第二步：编辑Path变量</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742154126.png" alt="1639742154126">
<figcaption aria-hidden="true">1639742154126</figcaption>
</figure>
<p>到此，我们就知道了环境变量的原理，并且完成了自己配置Java的环境变量。</p>
<h2 id="idea">2：IDEA</h2>
<p>前面在讲解第一个程序的常见问题的时候，我们说过了，会讲解一款非常优秀的开发工具，就是这里我们要讲解的IDEA。下面我们说一下这一块的课程安排：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/image-20240426010742391.png" alt="image-20240426010742391">
<figcaption aria-hidden="true">image-20240426010742391</figcaption>
</figure>
<p>首先，我们来讲解IDEA的概述和安装。</p>
<h3 id="idea概述和安装">2.1 IDEA概述和安装</h3>
<p>那什么是IDEA呢？</p>
<p><strong>IDEA：</strong>全称Intellij
IDEA，是用于Java语言开发的集成环境，是业界公认的目前用于Java程序开发最好的工具</p>
<p><strong>集成环境：</strong>把代码编写，编译，运行，调试等多种功能综合到一起的开发工具</p>
<p>举例说明，我们前面开发一个Java程序，需要下面这些工具的配合：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742942464.png" alt="1639742942464">
<figcaption aria-hidden="true">1639742942464</figcaption>
</figure>
<p>而我们现在开发一个Java程序，只需要一个工具就可以了：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639742964462.png" alt="1639742964462">
<figcaption aria-hidden="true">1639742964462</figcaption>
</figure>
<p>它把代码编写，编译，运行，调试等多种功能综合到一起了，这就是集成开发环境。除了IDEA以外，还有下面几种常见的用于Java程序开发的集成环境：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743071477.png" alt="1639743071477">
<figcaption aria-hidden="true">1639743071477</figcaption>
</figure>
<p>知道了IDEA是什么后，下面我们来说一下IDEA的下载和安装。</p>
<p><strong>IDEA的下载和安装：</strong></p>
<p><strong>下载：</strong>https://www.jetbrains.com/idea</p>
<p>也可以直接从老师给出的资料中获取。</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743252803.png" alt="1639743252803">
<figcaption aria-hidden="true">1639743252803</figcaption>
</figure>
<p><strong>安装：</strong>建议修改安装路径</p>
<p>安装图解：可以根据如下步骤完成IDEA的安装</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743315958.png" alt="1639743315958">
<figcaption aria-hidden="true">1639743315958</figcaption>
</figure>
<p>学完了IDEA的安装后，大家赶快动手安装一下吧。</p>
<h3 id="idea中helloworld">2.2 IDEA中HelloWorld</h3>
<p>安装完IDEA后，下面我们就来使用IDEA完成HelloWorld案例。</p>
<p>首先，我们来启动IDEA，启动的时候还有一些基本的配置，一起来看一下：</p>
<p>第一步：双击桌面上的IDEA图标，选择Do not import settings，点击OK</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743577863.png" alt="1639743577863">
<figcaption aria-hidden="true">1639743577863</figcaption>
</figure>
<p>第二步：看到如下界面</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743669575.png" alt="1639743669575">
<figcaption aria-hidden="true">1639743669575</figcaption>
</figure>
<p>选择：Evaluate for free，点击Evaluate</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743724589.png" alt="1639743724589">
<figcaption aria-hidden="true">1639743724589</figcaption>
</figure>
<p>第三步：点击Continue</p>
<p>第四步：看到如下界面，启动配置成功</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639743891697.png" alt="1639743891697">
<figcaption aria-hidden="true">1639743891697</figcaption>
</figure>
<p>接着，我们来完成HelloWorld案例：</p>
<p>这里先介绍下IDEA中的代码结构：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744009142.png" alt="1639744009142">
<figcaption aria-hidden="true">1639744009142</figcaption>
</figure>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744035432.png" alt="1639744035432">
<figcaption aria-hidden="true">1639744035432</figcaption>
</figure>
<p>接着，我们说一下IDEA中完成HelloWorld案例的基本流程：</p>
<p>① 新建一个空项目(javase_code)</p>
<p>② 新建一个新模块(idea_test)</p>
<p>③ 在idea_test模块的src下新建一个包(com.itheima)</p>
<p>④ 在com.itheima包下新建一个类(HelloWorld)</p>
<p>⑤ 在HelloWorld类中编写代码(main回车，sout回车)</p>
<p>⑥ 在IDEA中运行HelloWorld</p>
<p>下面，我们就一起来完成IDEA中HelloWorld案例的编写，编译和运行</p>
<p>① 新建一个空项目(javase_code)：</p>
<p>第一步：点击New Project</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744182660.png" alt="1639744182660">
<figcaption aria-hidden="true">1639744182660</figcaption>
</figure>
<p>第二步：选择Empty Project，点击Next</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744260619.png" alt="1639744260619">
<figcaption aria-hidden="true">1639744260619</figcaption>
</figure>
<p>第三步：修改项目名称，修改项目存储路径，点击Finish，弹出一个窗体，然后点击Create</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744399116.png" alt="1639744399116">
<figcaption aria-hidden="true">1639744399116</figcaption>
</figure>
<p>第四步：看到如下界面，空项目创建成功</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744560888.png" alt="1639744560888">
<figcaption aria-hidden="true">1639744560888</figcaption>
</figure>
<p>② 新建一个新模块(idea_test)</p>
<p>第一步：选择File，点击Project Structure...</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744630418.png" alt="1639744630418">
<figcaption aria-hidden="true">1639744630418</figcaption>
</figure>
<p>第二步：在弹出的窗体中，按照1,2,3的步骤选择，来新建一个模块</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744766449.png" alt="1639744766449">
<figcaption aria-hidden="true">1639744766449</figcaption>
</figure>
<p>第三步：在弹出的窗体中，默认选择Java模块，JDK选择的也是17，点击Next即可</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744868162.png" alt="1639744868162">
<figcaption aria-hidden="true">1639744868162</figcaption>
</figure>
<p>第四步：在弹出的窗体中，修改模块名称，点击Finish</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639744975845.png" alt="1639744975845">
<figcaption aria-hidden="true">1639744975845</figcaption>
</figure>
<p>第五步：然后点击OK即可</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639745070048.png" alt="1639745070048">
<figcaption aria-hidden="true">1639745070048</figcaption>
</figure>
<p>这样我们建好了一个模块：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639745121075.png" alt="1639745121075">
<figcaption aria-hidden="true">1639745121075</figcaption>
</figure>
<p>③ 在idea_test模块的src下新建一个包(io.github.ethan)</p>
<p>第一步：展开模块，按照1,2,3的步骤选择，来新建一个包</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639745243246.png" alt="1639745243246">
<figcaption aria-hidden="true">1639745243246</figcaption>
</figure>
<p>第二步：在弹出框里面输入包名，然后回车即可</p>
<p>这样我们建好了一个包：</p>
<p>④ 在com.itheima包下新建一个类(HelloWorld)</p>
<p>第一步：选中com.itheima这个包，按照1,2,3的步骤选择，来新建一个类</p>
<figure>
<img data-src="imgs/1639745503256.png" alt="1639745503256">
<figcaption aria-hidden="true">1639745503256</figcaption>
</figure>
<p>第二步：在弹出框里面输入类名，然后回车即可</p>
<figure>
<img data-src="imgs/1639745567182.png" alt="1639745567182">
<figcaption aria-hidden="true">1639745567182</figcaption>
</figure>
<p>这样我们建好了一个类：</p>
<figure>
<img data-src="imgs/1639745635074.png" alt="1639745635074">
<figcaption aria-hidden="true">1639745635074</figcaption>
</figure>
<p>⑤ 在HelloWorld类中编写代码(main回车，sout回车)</p>
<p>在类中编写代码，可以手动编写，也可以采用快捷方式编写</p>
<figure>
<img data-src="imgs/1639745672970.png" alt="1639745672970">
<figcaption aria-hidden="true">1639745672970</figcaption>
</figure>
<p>⑥ 在IDEA中运行HelloWorld</p>
<p>在代码中，右键选择Run 'HelloWorld.main()' 运行</p>
<figure>
<img data-src="imgs/1639745760081.png" alt="1639745760081">
<figcaption aria-hidden="true">1639745760081</figcaption>
</figure>
<p>在控制台输出了结果：</p>
<figure>
<img data-src="imgs/1639745840868.png" alt="1639745840868">
<figcaption aria-hidden="true">1639745840868</figcaption>
</figure>
<p>这样我们就完成了IDEA中HelloWorld案例。</p>
<p>回顾一下图中内容：</p>
<figure>
<img data-src="imgs/1639745874976.png" alt="1639745874976">
<figcaption aria-hidden="true">1639745874976</figcaption>
</figure>
<p>大家赶快动手练习一下吧。</p>
<h3 id="idea中基本配置注释">2.3 IDEA中基本配置&amp;注释</h3>
<p>刚才我在讲解代码的过程中，有同学可能觉得看的不是很清楚，那下面呢，我们就来对IDEA进行两个基本的设置：</p>
<p>第一个：修改背景主题为白色</p>
<figure>
<img data-src="imgs/1639746135128.png" alt="1639746135128">
<figcaption aria-hidden="true">1639746135128</figcaption>
</figure>
<p>第二个：修改字体大小</p>
<p>按照1,2,3,4进行设置即可</p>
<figure>
<img data-src="imgs/1639746171990.png" alt="1639746171990">
<figcaption aria-hidden="true">1639746171990</figcaption>
</figure>
<p>至于其他的设置，后面我们用到的时候再去讲解。</p>
<p>讲解完IDEA的这两个基本设置后，下面，我们说一下注释，那什么是注释呢？</p>
<ul>
<li>注释是指在程序中添加的说明性信息</li>
<li>注释不参与程序运行，仅起到说明作用</li>
</ul>
<p>这里我们再来介绍一下注释的分类：</p>
<figure>
<img data-src="imgs/1639746269066.png" alt="1639746269066">
<figcaption aria-hidden="true">1639746269066</figcaption>
</figure>
<p>了解了注释的作用和分类后，下面我们来对前面讲解过的HelloWorld案例添加注释：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">    Java程序中最基本的组成单位是类</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">    类的定义格式是：</span></span><br><span class="line"><span class="comment">        public class 类名 &#123;</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">        &#125;</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">HelloWorld</span> &#123;</span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">        这是main方法</span></span><br><span class="line"><span class="comment">        main方法是程序的入口方法，代码的执行是从main方法开始的</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        <span class="comment">//这是输出语句，能够将&quot;&quot;里面的内容输出到控制台，并且&quot;&quot;里面的内容是可以修改的</span></span><br><span class="line">        System.out.println(<span class="string">&quot;HelloWorld&quot;</span>);</span><br><span class="line">        System.out.println(<span class="string">&quot;Java&quot;</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>有了注释以后，我们再来看这段代码，明显就容易理解了。后面大家自己在编写代码的时候，也要多写写注释，在实际开发中，我们编写的程序也是要添加注释的。</p>
<p>这样既方便自己阅读，也方便别人阅读。</p>
<h3 id="idea中常用快捷键">2.4 IDEA中常用快捷键</h3>
<p>为了提高我们后续写程序的效率，这里呢，我们来讲一些IDEA中常用的快捷键：</p>
<ul>
<li>快速生成main方法和输出语句
<ul>
<li>main方法：main或者psvm，回车</li>
<li>输出语句：sout，回车</li>
</ul></li>
<li>常用快捷键
<ul>
<li>Ctrl+D：复制数据到下一行</li>
<li>Ctrl+X：剪切数据，可以用来删除所在行</li>
<li>Ctrl+Alt+L：格式化代码，建议自己写代码的时候就注意格式</li>
<li>Ctrl+/：对选中的代码添加单行注释，如果想取消注释，再来一次即可</li>
<li>Ctrl+Shift+/：对选中的代码添加多行注释，如果想取消注释，再来一次即可</li>
</ul></li>
</ul>
<p>根据老师的讲解，大家练习一下常用的快捷键吧。</p>
<h3 id="idea中模块操作">2.5 IDEA中模块操作</h3>
<p>IDEA的基本使用我们掌握了，最后呢，我们再来说一下，IDEA中的模块操作，而关于模块操作呢，分为三种：</p>
<ul>
<li>新建模块</li>
<li>删除模块</li>
<li>导入模块</li>
</ul>
<p>下面我们分别来操作一下。</p>
<p><strong>新建模块：</strong>HelloWorld案例中讲解过了，这里就不再讲解了，想不起来了，翻到上面去看看</p>
<p><strong>删除模块：</strong>删除模块又分为从工作区删除和从硬盘删除，你可以根据自己的需要，选择对应的方式进行删除</p>
<figure>
<img data-src="imgs/1639746912516.png" alt="1639746912516">
<figcaption aria-hidden="true">1639746912516</figcaption>
</figure>
<p><strong>导入模块：</strong></p>
<p>建议把模块复制到空项目所在路径下，然后找到新建模块的地方，只不过这一次不是新建模块，而是导入模块，所以，要选择Import
Module</p>
<figure>
<img data-src="imgs/1639747135494.png" alt="1639747135494">
<figcaption aria-hidden="true">1639747135494</figcaption>
</figure>
<p>找到要导入的模块，点击OK</p>
<figure>
<img data-src="imgs/1639747240911.png" alt="1639747240911">
<figcaption aria-hidden="true">1639747240911</figcaption>
</figure>
<p>然后一路next，直到出现如下的界面，点击Overwrite即可</p>
<figure>
<img data-src="imgs/1639747313468.png" alt="1639747313468">
<figcaption aria-hidden="true">1639747313468</figcaption>
</figure>
<p>看到下面的界面，点击Finish</p>
<figure>
<img data-src="imgs/1639747438239.png" alt="1639747438239">
<figcaption aria-hidden="true">1639747438239</figcaption>
</figure>
<p>最后点击OK即可</p>
<figure>
<img data-src="imgs/1639747499310.png" alt="1639747499310">
<figcaption aria-hidden="true">1639747499310</figcaption>
</figure>
<p>这样我们就成功的导入了一个模块：</p>
<figure>
<img data-src="imgs/1639747543186.png" alt="1639747543186">
<figcaption aria-hidden="true">1639747543186</figcaption>
</figure>
<p>导入模块的注意事项：</p>
<ul>
<li>把模块复制到空项目所在路径下</li>
<li>出现如下错误，知道如何处理</li>
</ul>
<figure>
<img data-src="imgs/1639746974241.png" alt="1639746974241">
<figcaption aria-hidden="true">1639746974241</figcaption>
</figure>
<p>到此，关于IDEA的模块操作我们就讲完了。</p>
<h2 id="基础语法">3：基础语法</h2>
<p>下面呢，我们来学习Java基础语法部分的知识，这些内容是我们后面编写程序的基本功，所以呢，大家得好好学习，下面我们说一下这一块的课程安排：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639748122994.png" alt="1639748122994">
<figcaption aria-hidden="true">1639748122994</figcaption>
</figure>
<p>至于这5个小知识，我们该怎么用，下面呢，我们分别来讲解，首先，我们学习字面量。</p>
<h3 id="字面量">3.1 字面量</h3>
<p>那什么是字面量呢？</p>
<ul>
<li>直接写出来的人可以理解的数据，在java中叫做字面量</li>
<li>举例：“HelloWorld”，666，13.14</li>
</ul>
<p>那Java中有哪些类型的字面量呢？</p>
<figure>
<img data-src="imgs/1639748232481.png" alt="1639748232481">
<figcaption aria-hidden="true">1639748232481</figcaption>
</figure>
<p>知道了Java中的字面量后，下面我们到IDEA中去演示一下字面量的使用：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">        字符串字面量：	    用双引号括起来的内容。&quot;HelloWorld&quot;,&quot;黑马程序员&quot;</span></span><br><span class="line"><span class="comment">		整数字面量：		不带小数的数字。666,-88</span></span><br><span class="line"><span class="comment">		小数字面量：		带小数的数字。13.14,-5.21</span></span><br><span class="line"><span class="comment">		字符字面量：		用单引号括起来的内容。&#x27;A&#x27;,&#x27;0&#x27;,&#x27;我&#x27;</span></span><br><span class="line"><span class="comment">		布尔字面量：		布尔值，表示真假。true,false</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">LiteralDemo</span> &#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        <span class="comment">//字符串字面量</span></span><br><span class="line">        System.out.println(<span class="string">&quot;HelloWorld&quot;</span>);</span><br><span class="line">        System.out.println(<span class="string">&quot;黑马程序员&quot;</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//整数字面量</span></span><br><span class="line">        System.out.println(<span class="number">666</span>);</span><br><span class="line">        System.out.println(-<span class="number">88</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//小数字面量</span></span><br><span class="line">        System.out.println(<span class="number">13.14</span>);</span><br><span class="line">        System.out.println(-<span class="number">5.21</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//字符字面量</span></span><br><span class="line">        System.out.println(<span class="string">&#x27;A&#x27;</span>);</span><br><span class="line">        System.out.println(<span class="string">&#x27;0&#x27;</span>);</span><br><span class="line">        System.out.println(<span class="string">&#x27;我&#x27;</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//布尔字面量</span></span><br><span class="line">        System.out.println(<span class="literal">true</span>);</span><br><span class="line">        System.out.println(<span class="literal">false</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>讲解完毕之后，大家赶快动手练习一下吧。</p>
<h3 id="数据类型">3.2 数据类型</h3>
<p>刚才我们学习了字面量，而Java是一种强类型语言，针对每种数据都给出了明确的数据类型，那我们刚才学习的几种字面量分别应该是什么类型的呢？</p>
<figure>
<img data-src="imgs/1639748532558.png" alt="1639748532558">
<figcaption aria-hidden="true">1639748532558</figcaption>
</figure>
<p>那为什么会有不同的数据类型呢？因为</p>
<ul>
<li>不同的数据类型分配了不同的内存空间</li>
<li>不同的内存空间，所存储的数据大小是不一样的</li>
</ul>
<p>在讲解不同的数据类型前，这里我们先普及一个小知识，就是字节的概念：</p>
<p>计算机中存储数据的最小单位是：字节(byte)，用B表示。</p>
<p>我们可以看一下硬盘存储的文件：以字节为单位</p>
<figure>
<img data-src="imgs/1639748712003.png" alt="1639748712003">
<figcaption aria-hidden="true">1639748712003</figcaption>
</figure>
<p>为了帮助大家更好的理解字节这个单位，我们来说一下，常见的存储单位：</p>
<p>1TB = 1024GB</p>
<p>1GB = 1024MB</p>
<p>1MB = 1024KB</p>
<p>1KB = 1024B</p>
<p>这样呢，我们对字节就能有一个基础认知。有了一个基础的认知之后，我们再来说Java中的数据类型</p>
<figure>
<img data-src="imgs/1639748785687.png" alt="1639748785687">
<figcaption aria-hidden="true">1639748785687</figcaption>
</figure>
<p>今天我们重点学习的是基本数据类型，关于引用数据类型，后面我们会重点学习。</p>
<p>在这里，我们给出每种基本数据类型的内存占用和取值范围，大家了解一下：</p>
<figure>
<img data-src="imgs/1639748866566.png" alt="1639748866566">
<figcaption aria-hidden="true">1639748866566</figcaption>
</figure>
<p><font color="red"><strong>说明：</strong></font>E+38表示：乘以10的38次方。同理E-45表示：乘以10的负45次方</p>
<p>整数默认是：int类型</p>
<p>浮点数默认是：double类型</p>
<p>这样呢，我们就了解了Java中的8种基本数据类型，以及每种数据类型占用字节的情况和取值范围。关于数据类型，我们就先讲到这里。</p>
<h3 id="变量">3.3 变量</h3>
<p>学完后数据类型后，下面呢，我们来学习Java中非常重要的一个知识：变量。</p>
<p>那为什么要有变量呢？看这里，我们写了一段代码，在控制台显示商品的促销活动：</p>
<figure>
<img data-src="imgs/1639749167095.png" alt="1639749167095">
<figcaption aria-hidden="true">1639749167095</figcaption>
</figure>
<p>结果，老板觉得，这个价格有点高，怕销售不好，所以决定再降100元，要求把所有的998的地方修改为888。于是你就开始改代码，改完之后如下：</p>
<figure>
<img data-src="imgs/1639749235135.png" alt="1639749235135">
<figcaption aria-hidden="true">1639749235135</figcaption>
</figure>
<p>结果呢？老板又觉得不划算，让你还是改回998吧，这个时候，你就要哭了。还好要修改的地方不多，要是有很多地方都要进行类似的操作，那多麻烦啊，有没有简化的方式呢？</p>
<p>答案当然是有的，我们找一个空间存储数据：888，并给它起个名字：price</p>
<figure>
<img data-src="imgs/1639749348313.png" alt="1639749348313">
<figcaption aria-hidden="true">1639749348313</figcaption>
</figure>
<p>这样我们的代码就可以写成这个样子：</p>
<figure>
<img data-src="imgs/1639749389479.png" alt="1639749389479">
<figcaption aria-hidden="true">1639749389479</figcaption>
</figure>
<p>如果要修改price里面的数据，我们只需要修改一处就可以了，代码不需要改动，但是却实现了任意修改price的效果。</p>
<figure>
<img data-src="imgs/1639749434719.png" alt="1639749434719">
<figcaption aria-hidden="true">1639749434719</figcaption>
</figure>
<p>其实，这就是Java中的变量技术。有了它之后，我们就可以把变化的数据用一个变量存储，代码正常编写即可，如果需要修改数据，我们修改变量的值就可以了。那什么是变量呢？</p>
<ul>
<li>变量就是内存中的存储空间</li>
<li>空间中存储的数据是可以发生改变</li>
</ul>
<p>知道了，什么是变量后，下面我们来说一下变量的定义格式：</p>
<ul>
<li><p>格式：数据类型 变量名 = 变量值;</p></li>
<li><p>范例：int price = 998;</p>
<p>根据变量名进行使用，可以输出，也可以修改值</p></li>
</ul>
<p>了解了变量的定义格式和使用方式后，下面我们到IDEA中去演示一下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">    格式：数据类型 变量名 = 变量值;</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">VariableDemo01</span> &#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        <span class="comment">//定义一个int类型的变量，用来表示价格</span></span><br><span class="line">        <span class="type">int</span> <span class="variable">price</span> <span class="operator">=</span> <span class="number">998</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//输出变量</span></span><br><span class="line">        System.out.println(price);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//修改变量的值</span></span><br><span class="line">        price = <span class="number">888</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//再次输出变量的值</span></span><br><span class="line">        System.out.println(price);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>学完了变量的定义，输出使用和修改值使用后，大家赶快动手练习一下吧。</p>
<h3 id="变量的案例">3.4 变量的案例</h3>
<p>了解了变量的定义和基本使用后，下面我们来做两个案例，熟悉一下变量的使用：</p>
<h4 id="手机信息描述">3.4.1 手机信息描述</h4>
<p>需求：分析下图指定数据，看看哪些可以通过变量表示，并思考采用那种数据类型，最后通过程序实现</p>
<p>指定数据：京东价，重量，颜色</p>
<figure>
<img data-src="imgs/1639749873847.png" alt="1639749873847">
<figcaption aria-hidden="true">1639749873847</figcaption>
</figure>
<p>分析：</p>
<p>①
京东价，重量，选择颜色这些字都是固定的，但是他们后面的数据是变化的，所以要用变量表示</p>
<p>② 价格，可以用double或者int类型来表示，这里我们用int类型表示；</p>
<p>​ 重量，用double类型表示；颜色，用String类型表示</p>
<p>分析完毕之后，下面我们到IDEA中去实现一下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">    手机信息描述</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">VariableTest01</span> &#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        <span class="comment">//定义秒杀价变量</span></span><br><span class="line">        <span class="type">double</span> <span class="variable">price</span> <span class="operator">=</span> <span class="number">3599.00</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//定义颜色变量</span></span><br><span class="line">        <span class="type">String</span> <span class="variable">color</span> <span class="operator">=</span> <span class="string">&quot;蓝色&quot;</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//定义版本变量，纪录的是内存大小</span></span><br><span class="line">        <span class="type">int</span> <span class="variable">size</span> <span class="operator">=</span> <span class="number">8</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">//        System.out.println(price);</span></span><br><span class="line"><span class="comment">//        System.out.println(color);</span></span><br><span class="line"><span class="comment">//        System.out.println(size);</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//为了输出效果好看一些，我加上一些内容</span></span><br><span class="line">        System.out.println(<span class="string">&quot;秒杀价是：&quot;</span>+price);</span><br><span class="line">        System.out.println(<span class="string">&quot;你选择的颜色是：&quot;</span>+color);</span><br><span class="line">        System.out.println(<span class="string">&quot;你选择的版本是：&quot;</span>+size);</span><br><span class="line"></span><br><span class="line">        <span class="comment">//字符串字面值+任意的数据=字符串数据</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>讲解完毕后，大家赶快动手练习一下吧。</p>
<h4 id="疫情防控信息采集表">3.4.2 疫情防控信息采集表</h4>
<p>需求：分析右图信息，并通过程序实现</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639749999955.png" alt="1639749999955">
<figcaption aria-hidden="true">1639749999955</figcaption>
</figure>
<p>通过上图数据，我们可以根据变化的数据，提取出下图：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639750064471.png" alt="1639750064471">
<figcaption aria-hidden="true">1639750064471</figcaption>
</figure>
<p>分析：</p>
<p>① String name = “风清扬”;</p>
<p>② int age = 36;</p>
<p>③ char gender = ‘男’; 也可以采用String类型表示</p>
<p>④ double temperature = 36.2;</p>
<p>⑤ boolean flag = true; 也可以采用char或者String表示</p>
<p>分析完毕之后，下面我们到IDEA中去实现一下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">    疫情防控信息采集表</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">VariableTest02</span> &#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        <span class="comment">//定义变量</span></span><br><span class="line">        <span class="type">String</span> <span class="variable">name</span> <span class="operator">=</span> <span class="string">&quot;风清扬&quot;</span>;</span><br><span class="line">        <span class="type">int</span> <span class="variable">age</span> <span class="operator">=</span> <span class="number">18</span>;</span><br><span class="line">        <span class="type">char</span> <span class="variable">gender</span> <span class="operator">=</span> <span class="string">&#x27;男&#x27;</span>;</span><br><span class="line">        <span class="type">double</span> <span class="variable">temperature</span> <span class="operator">=</span> <span class="number">36.2</span>;</span><br><span class="line">        <span class="type">boolean</span> <span class="variable">flag</span> <span class="operator">=</span> <span class="literal">true</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//输出数据</span></span><br><span class="line">        System.out.println(<span class="string">&quot;姓名是：&quot;</span> + name);</span><br><span class="line">        System.out.println(<span class="string">&quot;年龄是：&quot;</span> + age);</span><br><span class="line">        System.out.println(<span class="string">&quot;性别是：&quot;</span> + gender);</span><br><span class="line">        System.out.println(<span class="string">&quot;体温是：&quot;</span> + temperature);</span><br><span class="line">        System.out.println(<span class="string">&quot;是否接种过疫苗：&quot;</span> + flag);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>讲解完毕后，大家赶快动手练习一下吧。</p>
<h3 id="变量的注意事项">3.5 变量的注意事项</h3>
<p>关于变量的使用呢，我们讲解几个小的注意事项，大家了解一下，这样呢，遇到变量的问题后，大家就可以知道如何解决了。</p>
<p>变量的注意事项：</p>
<ul>
<li>变量名不能重复</li>
<li>变量未赋值，不能使用</li>
<li>定义long类型变量，数据后面加L</li>
<li>定义float类型变量，数据后面加F</li>
</ul>
<p>IDEA中代码演示如下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">    变量使用的注意事项</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">VariableDemo02</span> &#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        <span class="type">int</span> <span class="variable">age</span> <span class="operator">=</span> <span class="number">10</span>;</span><br><span class="line"><span class="comment">//        int age = 20;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//        int money;</span></span><br><span class="line"><span class="comment">////        money = 20;</span></span><br><span class="line"><span class="comment">//        System.out.println(money);</span></span><br><span class="line"></span><br><span class="line">        <span class="type">long</span> <span class="variable">money</span> <span class="operator">=</span> <span class="number">1000000000000L</span>;</span><br><span class="line">        <span class="type">float</span> <span class="variable">price</span> <span class="operator">=</span> <span class="number">12.34F</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>讲解完毕后，大家赶快动手练习一下吧。</p>
<h3 id="关键字">3.6 关键字</h3>
<p>下面我们来学习一个小的知识点：关键字。</p>
<p>首先，我们得知道什么是关键字：</p>
<p><strong>关键字：</strong>就是被Java语言赋予了特定含义的单词</p>
<p>我们先来看一下，曾经写过的代码中，出现的关键字：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639750407320.png" alt="1639750407320">
<figcaption aria-hidden="true">1639750407320</figcaption>
</figure>
<p>了解了什么是关键字后，我们来说一下<strong>关键字的特点</strong>：</p>
<ul>
<li>关键字的字母全部小写</li>
<li>常用的代码编辑器，针对关键字有特殊的颜色标记，非常直观</li>
</ul>
<p>知道了关键字的特点后，这里我们给大家看看Java中的关键字：</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639750514625.png" alt="1639750514625">
<figcaption aria-hidden="true">1639750514625</figcaption>
</figure>
<p>虽然比较多，但是大家不用担心。因为：关键字，我们不需要专门记忆。这些关键字我们在开发中比较常用的，写的多了，你自然就记住了。好了，Java中的关键字我们就先讲到这里。</p>
<h3 id="标识符">3.7 标识符</h3>
<p>下面呢，我们来讲解基础语法部分最后一个知识：标识符。</p>
<p>首先，我们来说一下什么是标识符：</p>
<p><strong>标识符：</strong>就是给类，方法，变量等起名字的符号</p>
<p>比如，我们前面写类的时候，起的名字：HelloWorld，变量的时候，价格，price等，这就是标识符。</p>
<p>那这个符号你能随便写呢，当然是不能的，这里我们来看一下<strong>标识符的组成规则</strong>：由数字、字母、下划线(_)和美元符($)组成</p>
<p>了解了组成规则后，这里我们还得说一下<strong>注意事项：</strong></p>
<ul>
<li>不能以数字开头</li>
<li>不能是关键字</li>
<li>区分大小写</li>
</ul>
<p>判断下面哪些标识符不符合规则</p>
<p>bj b2 2b _2b class helloworld</p>
<p>按照我们讲解的规则，大家应该能够判断出来：2b和class是不符合规则的。</p>
<p>知道了标识符的组成规则和注意事项后，这里我们再说一下起名字常用的<strong>命名约定：</strong></p>
<ul>
<li>小驼峰命名法
<ul>
<li>约定1：标识符一个单词的时候，首字母小写</li>
<li>范例1：name</li>
<li>约定2：标识符是多个单词的时候，第一个单词首字母小写，其他单词首字母大写</li>
<li>范例2：firstName</li>
</ul></li>
<li>大驼峰命名法
<ul>
<li>约定1：标识符一个单词的时候，首字母大写</li>
<li>范例1：Hello</li>
<li>约定2：标识符是多个单词的时候，每个单词首字母大写</li>
<li>范例2：HelloWorld</li>
</ul></li>
</ul>
<p>一般来说，小驼峰命名法适用于对方法，变量等起名字。大驼峰命名法适用于对类，接口等起名字。</p>
<p>最后再强调一点，就是我们起名字，最好能够做到：<strong>见名知意</strong></p>
<p>比如，我们前面讲解过的变量的案例中，我们起的名字就做到了见名知意。</p>
<figure>
<img data-src="https://cdn.jsdelivr.net/gh/EthanLiu6/ImgsForMe/blog_images/1639751032842.png" alt="1639751032842">
<figcaption aria-hidden="true">1639751032842</figcaption>
</figure>
<p>好了，到此关于标识符我们就先讲到这里。</p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="reward-container">
  <div>请我一杯咖啡吧！</div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="/images/wChat.png" alt="Ethan Liu 微信">
        <span>微信</span>
      </div>

  </div>
</div>

          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>Ethan Liu
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/" title="JavaSE基础——Day01 JavaSE基础——Java入门&amp;IDEA&amp;基础语法">http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE基础/day01Java入门&IDEA&基础语法/</a>
  </li>
  <li class="post-copyright-license">
      <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC8="><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


          <div class="post-tags">
              <a href="/tags/Java/" rel="tag"><i class="fa fa-tag"></i> Java</a>
              <a href="/tags/Java%E5%9F%BA%E7%A1%80/" rel="tag"><i class="fa fa-tag"></i> Java基础</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2024/02/06/Academic/%E6%AF%94%E8%B5%9B/2024%E5%B9%B4%E6%95%B0%E6%A8%A1%E7%BE%8E%E8%B5%9B/" rel="prev" title="2024年数模美赛">
                  <i class="fa fa-angle-left"></i> 2024年数模美赛
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2024/03/14/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day02%E8%BF%90%E7%AE%97%E7%AC%A6&%E9%80%89%E6%8B%A9%E8%AF%AD%E5%8F%A5/" rel="next" title="JavaSE基础——Day02 JavaSE基础——运算符&选择语句">
                  JavaSE基础——Day02 JavaSE基础——运算符&选择语句 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments" id="SOHUCS" sid="1f34dcf3b743f850784de6d903de63b7"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2023-2024 – 
    <span itemprop="copyrightYear">2024</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">Is Ethan's</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
    <span title="站点总字数">113k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">6:51</span>
  </span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>

    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>
  <a role="button" class="book-mark-link book-mark-link-fixed"></a>

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL0V0aGFuTGl1Ni8=" title="在 GitHub 上关注我" aria-label="在 GitHub 上关注我"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.33/fancybox/fancybox.umd.js" integrity="sha256-+2+qOqR8CKoHh/AsVR9k2qaDBKWjYNC2nozhYmv5j9k=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/medium-zoom/1.1.0/medium-zoom.min.js" integrity="sha256-ZgMyDAIYDYGxbcpJcfUnYwNevG/xi9OHKaR/8GK+jWc=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/bookmark.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>

  <script class="next-config" data-name="pdf" type="application/json">{"object_url":{"url":"https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.2.12/pdfobject.min.js","integrity":"sha256-g2xji1rlE3KsGVClvuxTbcR0Kn2+wtQADSff2Tbb4zA="},"url":"/lib/pdf/web/viewer.html"}</script>
  <script src="/js/third-party/tags/pdf.js"></script>



  <script src="/js/third-party/fancybox.js"></script>



  
  <script data-pjax async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"all","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


  <script src="https://cdnjs.cloudflare.com/ajax/libs/quicklink/2.3.0/quicklink.umd.js" integrity="sha256-yvJQOINiH9fWemHn0vCA5lsHWJaHs6/ZmO+1Ft04SvM=" crossorigin="anonymous"></script>
  <script class="next-config" data-name="quicklink" type="application/json">{"enable":true,"home":true,"archive":true,"delay":true,"timeout":3000,"priority":true,"url":"http://ethanliu6.github.io/2024/03/13/JavaNotes/JavaSE%E5%9F%BA%E7%A1%80/day01Java%E5%85%A5%E9%97%A8&IDEA&%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/"}</script>
  <script src="/js/third-party/quicklink.js"></script>
<script class="next-config" data-name="changyan" type="application/json">{"enable":true,"appid":"cyxf6tytI","appkey":"90987f30c4b5248baad5a04c7a6abfe1","count":true}</script>
<script src="/js/third-party/comments/changyan.js"></script>

</body>
</html>
